package com.example.app.components.MyButton

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.material3.ButtonColors
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ButtonElevation
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.example.app.components.MyText.MyText
import com.example.app.ui.theme.buttonLargeHeight
import com.example.app.ui.theme.buttonLargeWidth
import com.example.app.ui.theme.buttonMediumHeight
import com.example.app.ui.theme.buttonMediumWidth
import com.example.app.ui.theme.buttonSmallHeight
import com.example.app.ui.theme.buttonSmallWidth

@Composable
fun MyOutlinedButton(onClick: () -> Unit,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    shape: Shape = ButtonDefaults.outlinedShape,
    colors: ButtonColors = ButtonDefaults.outlinedButtonColors(),
    elevation: ButtonElevation? = null,
    //border: BorderStroke? = ButtonDefaults.outlinedButtonBorder(enabled),
    border: BorderStroke? = BorderStroke(2.dp,
        MaterialTheme.colorScheme.outline),
    contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
    interactionSource: MutableInteractionSource? = null,
    content: @Composable RowScope.() -> Unit) {
    OutlinedButton(
        onClick,
        modifier,
        enabled,
        shape,
        colors,
        elevation,
        border,
        contentPadding,
        interactionSource,
        content,
    )
}
@Preview
@Composable
fun MyOutlinedButtonDemo() {
    MyOutlinedButton(
        modifier = Modifier
            .height(buttonSmallHeight)
            .width(buttonSmallWidth),
        contentPadding = PaddingValues(0.dp),
        onClick = { /*TODO*/ },
    ) {
        MyText(text = "测试按钮",
            style = MaterialTheme.typography.bodySmall.copy(fontSize = MaterialTheme.typography.bodySmall.fontSize))
    }
}